<template>
  <div>
    <f-form ref='form' :action='api.sendInfo' :form-key='this.formItem.sendInfoId' :file-ids='fileIds'>
      <div>
        <f-form-item label='销售金额' :required='true' data-type='number' disabled name='totalSaleAmount' :value.sync='formItem.totalSaleAmount' />
        <f-form-item label='发票要求' name='invoiceRemark' disabled :value.sync='formItem.invoiceRemark' />
        <f-form-item label='发票号码' :required='true' name='invoiceNo' :value.sync='formItem.invoiceNo' />
        <f-form-item label='开票日期' type='date' name='invoiceDate' :required='true' :value='formItem.invoiceDate' />
        <f-form-item label='附件' type='upload' name='paymentImage' :value='formItem.paymentImage' :file-max='3' :busId='this.formItem.sendInfoId' busType='BusHyorderSendinfo' :realRemove='true' @uploadSuccess='uploadSuccess' />
      </div>
    </f-form>
  </div>
</template>
<script>

import api from "./../js/api"

export default {
  name: "SendInfoEdit",
  components: {},
  data() {
    let me = this
    return {
      api: Object.assign(api, this.api),
      //列表初始化查询参数
      queryParam: {},
      loaded: false,
      selectIds: "",
      fileIds: null,
      formItem: this.getFormItem()
    }
  },
  created() {
  },
  computed: {},
  methods: {
    getFormItem() {
      return {
        paymentId: "",
        amountDate: "",
        invoiceNo: "",
        invoiceDate: "",
        remark: ""
      }
    },
    setData(data) {
      if (data.orderId) {
        this.$refs.form.resetFields()
        this.formItem = data
        this.http.get(this, {
          url: this.api.hyorder.get,
          params: {
            handlerName: "hyOrderGetHandler",
            orderId: data.orderId
          },
          success: function(me, data) {
            me.formItem = data
            me.loaded = true
          }
        })
      }
    },
    /**
     * 文件上传回调
     */
    uploadSuccess(fileUrl, files, fileIds, removeIds) {
      this.fileIds = fileIds
      this.removeIds.push(...removeIds)
    },
    handleSubmit() {
      this.$refs["form"].submit({
        orderId: this.formItem.orderId
      }, this.handleSuccess)
    },
    handleSuccess() {
      this.$emit("closeDrawer", false)
    }
  }
}
</script>
